<div class="articles index">
	<h2><?php echo (isset($menu)) ? __d('articles','Articles for link').': '.$this->Html->link($menu['Menus']['name'],array('controller'=>'menuses','action'=>'index')) : __d('articles','Articles',true)?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('id');?></th>
			<th><?php echo $this->Paginator->sort('name',__d('articles','Article name',true));?></th>
			<th><?php echo $this->Paginator->sort('status');?></th>
			<th class="actions"><?php 
				$menu_id = (isset($menu['Menus']['id'])) ? $menu['Menus']['id'] : null;
				echo $this->Html->link(__d('articles','+ Article'), array('controller'=>'articles','action' => 'add',$menu_id)); ?></th>
	</tr>
	<tr class="filtr">
		<?php echo $this->Form->create('Article',array('url'=>array('controller'=>'articles', 'action'=>'index'),'name'=>'_display_articles_'));?>
		<th><?php echo __d('articles','Filtr:',true)?></th>
		<th>&nbsp;</th>
		<th><?php echo $this->Form->input('status',array('options'=>array('0'=>__d('articles','Deactive',true),'1'=>__d('articles','Active',true)),'label'=>false,'div'=>false,'empty'=>'','onchange'=>'document._display_articles_.submit(); event.returnValue = false; return false;'))?></th>
		<th class="actions">
			<?php echo $this->Html->link(__d('articles','Cancel'), array('controller'=>'articles','action' => 'index',$menu_id)); ?>
		</th>
		<?php echo $this->Form->end();?>
	</tr>
	<?php
	
	foreach ($articles as $article): 
		$url = $this->Html->url( array('action' => 'edit', $article['Article']['id'],'d'=>$article['Article']['domain_id']),true);
	?>
	
	<tr>
		<td onclick="document.location='<?php echo $url;?>'"><?php echo h($article['Article']['id']); ?>&nbsp;</td>
		<td onclick="document.location='<?php echo $url;?>'"><?php echo h($article['Article']['name']); ?>&nbsp;</td>
		<td><?php echo $this->Form->input('Article.status',array('value'=>$article['Article']['status'],'label'=>false,'type'=>'checkbox','checked'=>$article['Article']['status']));?></td>
		<td class="actions">
			<?php // echo $this->Html->link(__d('articles','Send'), array('action' => 'send', $article['Article']['id'],'d'=>$article['Article']['domain_id'])); ?>
			<?php 
				echo $this->Html->link(__d('articles','View'), array('action' => 'view', $article['Article']['id'],'d'=>$article['Article']['domain_id']),array('class'=>'action-left'));
				echo $this->Html->link(__d('articles','Edit'), array('action' => 'edit', $article['Article']['id'],'d'=>$article['Article']['domain_id']),array('class'=>'action-inner'));
				echo $this->Form->postLink(__d('articles','Delete'), array('action' => 'delete', $article['Article']['id']),array('class'=>'action-right'), __d('articles','Are you sure you want to delete # %s?', $article['Article']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	$this->Paginator->options(array('url' => $this->passedArgs));
	echo $this->Paginator->counter(array(
	'format' => __d('articles','Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __d('articles','previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__d('articles','next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
<?php echo $this->element('/menu/left')?>
